//
//  HomeHDHeaderReusableView.m
//  jingdongfang
//
//  Created by LJL on 2018/5/14.
//  Copyright © 2018年 BOE. All rights reserved.
//

#import "HomeHDHeaderReusableView.h"

@implementation HomeHDHeaderReusableView

- (void)awakeFromNib
{
    [super awakeFromNib];
    self.typeL.text = NSLocalizedString(@"home14", nil);
    [self.hotBtn setTitle:NSLocalizedString(@"home15", nil) forState:UIControlStateNormal];
    [self.newsBtn setTitle:NSLocalizedString(@"home16", nil) forState:UIControlStateNormal];

}

- (IBAction)hotBtnClick:(id)sender
{
    if (!_hotBtn.selected)
    {
        _hotBtn.selected = YES;
        _newsBtn.selected = NO;
        if (self.hotBlock)
        {
            self.hotBlock();
        }
        [self layoutSubviews];
    }
}

- (IBAction)newsBtnClick:(id)sender
{
    if (!_newsBtn.selected)
    {
        _hotBtn.selected = NO;
        _newsBtn.selected = YES;
        if (self.newsBlock)
        {
            self.newsBlock();
        }
        [self layoutSubviews];
    }
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    if (_hotBtn.selected)
    {
        _hotBtn.titleLabel.font = [UIFont systemFontOfSize:18];
    } else {
        _hotBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    }
    
    if (_newsBtn.selected)
    {
        _newsBtn.titleLabel.font = [UIFont systemFontOfSize:18];
    } else {
        _newsBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    }
}


@end
